#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;

void findMin(int a[], int &i, int N)
{
   i = a[0];
   while(i / 10 < N)
   {
       if(i % 10 > a[i / 10]) i = a[i / 10];
       i += 10;
   }
   i %= 10;
}

void findvalue(int a[], int &min, int &max, const int n)
{
    max = a[0];
    min = a[0];
    for(int i = 0; i < n; i++)
    {
        if(a[i] > max) max = a[i];
            else if(a[i] < min)min = a[i];
    }

    cout << "max = " << max << endl;
    cout << "min = " << min << endl;
}

int main(void)
{
    srand((unsigned)time(NULL));
    const int N = 10;
    int A[N];
    int max = 0, min = 0;
    do
    {
        A[max] = rand()%11;
    } while (max++ < N);
    
    findvalue(A, min, max, N);
    // int res = 0;
    // findMin(A,res,N);
    // cout << "min data is " << res << endl;
}
